package com.xbs.controller.hitchhiking;

import java.io.IOException;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.websocket.Session;

import com.xbs.controller.base.BaseServlet;
import com.xbs.entity.HitchEntity;
import com.xbs.entity.HitchhikeEntity;
import com.xbs.entity.StoreEntity;
import com.xbs.service.hitchhiking.HitchOrderService;
import com.xbs.service.hitchhiking.HitchService;
@WebServlet("/hitch/order")
public class HitchOrderServlet extends BaseServlet{
		@Override
		protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
			
	
			HitchService hitchservie = new HitchService();
			
			/**
			 * 1.根据用户选择进行填写订单
			 */
			String hitchtype = req.getParameter("hitchtype");
			String startdoor = req.getParameter("startdoor");
			String enddoor = req.getParameter("enddoor");
			req.getSession().setAttribute("hitchtype", hitchtype);
			req.getSession().setAttribute("startdoor", startdoor);
			req.getSession().setAttribute("enddoor", enddoor);
			
			List<HitchEntity> orderlst = hitchservie.getCarToOrder(hitchtype,startdoor,enddoor);
			HitchEntity order = orderlst.get(0);
				Date time = order.getHitch_time();
				req.setAttribute("time", time);
				req.setAttribute("order", order);
			//转发		
			forward("businessview/llp_order/hitchorder");
		}
}
